package com.foo.js;

import org.apache.wicket.AttributeModifier;
import org.apache.wicket.markup.head.IHeaderResponse;
import org.apache.wicket.markup.head.JavaScriptHeaderItem;
import org.apache.wicket.markup.html.form.Button;
import org.apache.wicket.model.Model;
import org.apache.wicket.request.resource.JavaScriptResourceReference;
import org.apache.wicket.request.resource.ResourceReference;

public class ConfirmButton extends Button {

	private static final long serialVersionUID = 1L;

	public ConfirmButton(String id) {
		super(id);
		setVersioned(false);
		add(new AttributeModifier("onclick", new Model<String>(
				"return alert('Yuci')")));
	}

	@Override
	public void renderHead(IHeaderResponse response) {
		ResourceReference ref = new JavaScriptResourceReference(
				ConfirmButton.class, "ConfirmButton.js");
		response.render(JavaScriptHeaderItem.forReference(ref));
	}
}